package com.itheima.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
// 实体类与表的绑定
@TableName(value = "tb_user")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    @TableField(value = "username") // 属性名与字段名不一致
    private String name;

    private Boolean isMarried; // true转成数据库时 1, false: 0

    @TableField(value = "`order`")// order在数据库中是关键字，区别就得加反单引号
    private Integer order;

    @TableField(exist = false) // 数据库不存在这个字段，忽略它
    private String address;
}
